<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!--      <el-form-item label="道路编码" prop="roadId">-->
<!--        <el-input-->
<!--          v-model="queryParams.roadId"-->
<!--          placeholder="请输入道路编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="道路名称" prop="roadName">-->
<!--        <el-input-->
<!--          v-model="queryParams.roadName"-->
<!--          placeholder="请输入道路名称"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="隧道编码" prop="tunnelId">-->
<!--        <el-input-->
<!--          v-model="queryParams.tunnelId"-->
<!--          placeholder="请输入隧道编码"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="隧道名称" prop="tunnelName">
        <el-input
          v-model="queryParams.tunnelName"
          placeholder="请输入隧道名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="里程桩号" prop="mileageNumber">-->
<!--        <el-input-->
<!--          v-model="queryParams.mileageNumber"-->
<!--          placeholder="请输入里程桩号"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="设施名称" prop="facilityName">
        <el-select v-model="queryParams.facilityName" placeholder="请输入设施名称" clearable :style="{width: '100%'}">
          <el-option v-for="(item, index) in fieldfacility" :key="index" :label="item.label"
                     :value="item.value" :disabled="item.disabled"></el-option>
        </el-select>
      </el-form-item>
<!--      <el-form-item label="检查日期" prop="lastInspectionDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.lastInspectionDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择上次检查日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="本次检查日期" prop="inspectionDate">-->
<!--        <el-date-picker clearable-->
<!--          v-model="queryParams.inspectionDate"-->
<!--          type="date"-->
<!--          value-format="yyyy-MM-dd"-->
<!--          placeholder="请选择本次检查日期">-->
<!--        </el-date-picker>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="状况描述" prop="positionDescribe">-->
<!--        <el-input-->
<!--          v-model="queryParams.positionDescribe"-->
<!--          placeholder="请输入状况描述"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="建议" prop="advice">-->
<!--        <el-input-->
<!--          v-model="queryParams.advice"-->
<!--          placeholder="请输入建议"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="养护机构" prop="maintenanceOrganization">-->
<!--        <el-input-->
<!--          v-model="queryParams.maintenanceOrganization"-->
<!--          placeholder="请输入养护机构"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="检查人" prop="inspection">
        <el-input
          v-model="queryParams.inspection"
          placeholder="请输入检查人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="检查状态" prop="inspectionCondition">
<!--        <el-input-->
<!--          v-model="queryParams.inspectionCondition"-->
<!--          placeholder="请输入检查状态"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
        <el-select v-model="queryParams.inspectionCondition" placeholder="请输入检查状态"  clearable :style="{width: '100%'}">
          <el-option v-for="(item, index) in fieldinspectionCondition" :key="index" :label="item.label"
                     :value="item.value" :disabled="item.disabled"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['biz:specialinspection:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['biz:specialinspection:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
      <el-button
        type="primary"
        plain
        size="mini"
        icon="el-icon-edit"
        @click="handleDesign7()"
        v-hasPermi="['biz:specialevaluate:list']"
      >填写评价</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['biz:specialinspection:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['biz:specialinspection:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="specialinspectionList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="记录表编码" align="center" prop="specialInspectionId" />
<!--      <el-table-column label="道路编码" align="center" prop="roadId" />-->
<!--      <el-table-column label="道路名称" align="center" prop="roadName" />-->
<!--      <el-table-column label="隧道编码" align="center" prop="tunnelId" />-->
      <el-table-column label="隧道名称" align="center" prop="tunnelName" />
<!--      <el-table-column label="里程桩号" align="center" prop="mileageNumber" />-->
      <el-table-column label="设施名称" align="center" prop="facilityName" />
<!--      <el-table-column label="检查内容" align="center" prop="examinationContent" />-->
<!--      <el-table-column label="上次检查日期" align="center" prop="lastInspectionDate" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.lastInspectionDate, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="本次检查日期" align="center" prop="inspectionDate" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.inspectionDate, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="状况描述" align="center" prop="positionDescribe" />-->
<!--      <el-table-column label="建议" align="center" prop="advice" />-->
<!--      <el-table-column label="养护机构" align="center" prop="maintenanceOrganization" />-->
      <el-table-column label="检查人" align="center" prop="inspection" />
      <el-table-column label="检查状态" align="center" prop="inspectionCondition" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['biz:specialinspection:edit']"
          >修改</el-button>
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['biz:specialinspection:remove']"-->
<!--          >删除</el-button>-->
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleCheck(scope.row)"
            v-hasPermi="['civil:specialinspection:edit']"
          >查看</el-button>

        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改专项检查对话框 filterable属性即可启用搜索功能-->
    <el-dialog :title="title" :visible.sync="openadd" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <!--        公路表：公路名称-->
        <el-form-item label="道路名称"  prop="roadName">
          <el-select v-model="form.roadName" filterable clearable placeholder="请选择道路名称">
            <el-option
              v-for="item in gongluList"
              :key="item.id + ''"
              :label="item.field2"
              :value="item.field2 + ''"
              :disabled="item.status == 1"
            ></el-option>
          </el-select>
        </el-form-item>
        <!--      公路表：根据公路名称确定公路编码-->
        <el-form-item label="道路编码" prop="roadId">
<!--          <el-input v-model="form.roadId" placeholder="请输入道路编码" />-->
          <el-select v-model="form.roadId" filterable clearable placeholder="请选择道路编码">
            <el-option
              v-for="item in gongluList"
              :key="item.id + ''"
              :label="item.field1"
              :value="item.field1 + ''"
              :disabled="item.status == 1"
              v-if="item.field2 == form.roadName"
            ></el-option>
          </el-select>
        </el-form-item>
<!--        <el-form-item label="道路名称" prop="roadName">-->
<!--          <el-input v-model="form.roadName" placeholder="请输入道路名称" />-->
<!--        </el-form-item>-->

<!--        隧道表：根据公路名称确定隧道编码-->
        <!--            比较 dict.field22 == form.roadlName 可能导致意外类型强制,将等号替换为===-->
        <el-form-item label="隧道编码" prop="tunnelId">
          <el-select v-model="form.tunnelId" filterable clearable placeholder="请选择隧道编码">
            <el-option
              v-for="dict in suidaoList"
              :key="dict.field1 + ''"
              :label="dict.field1"
              :value="dict.field1 + ''"
              v-if="dict.field22 == form.roadName"
            ></el-option>
          </el-select>
        </el-form-item>
        <!--        隧道表：根据隧道编码确定隧道名称-->
        <el-form-item label="隧道名称" prop="tunnelName">
          <el-select v-model="form.tunnelName" filterable clearable placeholder="请选择隧道名称">
            <el-option
              v-for="dict in suidaoList"
              :key="dict.field2 + ''"
              :label="dict.field2"
              :value="dict.field2 + ''"
              v-if="dict.field1 == form.tunnelId"
            ></el-option>
          </el-select>
        </el-form-item>
        <!--        土建结构设备管理表，根据公路、隧道确定里程桩号,，v-if判断多个条件&& 和||-->
        <el-form-item label="里程桩号"  prop="mileageNumber">
          <el-select v-model="form.mileageNumber"  filterable clearable placeholder="请选择里程桩号">
            <el-option
              v-for="dict in facilityList"
              :key="dict.mileageNumber + ''"
              :label="dict.mileageNumber"
              :value="dict.mileageNumber + ''"
              v-if="dict.roadName == form.roadName && dict.tunnelId == form.tunnelId && dict.tunnelName == form.tunnelName "
            ></el-option>
          </el-select>
        </el-form-item>
<!--        土建结构设备管理表：根据公路、隧道、里程桩号确定设备,注意这里四个条件满足之后唯一确定一个设备-->
        <el-form-item label="设施名称" prop="facilityName">
<!--          原来是固定的表中选取-->
<!--          <el-select v-model="form.facilityName" placeholder="请输入设施名称" clearable :style="{width: '100%'}">-->
<!--            <el-option v-for="(item, index) in fieldfacility"-->
<!--                       :key="index"-->
<!--                       :label="item.label"-->
<!--                       :value="item.value"-->
<!--                       :disabled="item.disabled"-->
<!--            ></el-option>-->
<!--          </el-select>-->
          <el-select v-model="form.facilityName" filterable clearable placeholder="请选择设施名称">
            <el-option
              v-for="dict in facilityList"
              :key="dict.facilityName + ''"
              :label="dict.facilityName"
              :value="dict.facilityName + ''"
              v-if="dict.roadName == form.roadName &&  dict.tunnelId == form.tunnelId &&  dict.tunnelName == form.tunnelName&&  dict.mileageNumber== form.mileageNumber  "
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="检查内容">
          <editor v-model="form.examinationContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="上次日期" prop="lastInspectionDate">
          <el-date-picker clearable
            v-model="form.lastInspectionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择上次检查日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="本次日期" prop="inspectionDate">
          <el-date-picker clearable
            v-model="form.inspectionDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择本次检查日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="状况描述" prop="positionDescribe">
          <el-input v-model="form.positionDescribe" placeholder="请输入状况描述" />
        </el-form-item>
        <el-form-item label="建议" prop="advice">
          <el-input v-model="form.advice" placeholder="请输入建议" />
        </el-form-item>
        <el-form-item label="养护机构" prop="maintenanceOrganization">
          <el-input v-model="form.maintenanceOrganization" placeholder="请输入养护机构" />
        </el-form-item>
        <el-form-item label="检查人" prop="inspection">
          <el-input v-model="form.inspection" placeholder="请输入检查人" />
        </el-form-item>
        <el-form-item label="检查状态" prop="inspectionCondition">
<!--          <el-input v-model="form.inspectionCondition" placeholder="请输入检查状态" />-->
          <el-select v-model="form.inspectionCondition" placeholder="请输入检查状态"  clearable :style="{width: '100%'}">
            <el-option v-for="(item, index) in fieldinspectionCondition" :key="index" :label="item.label"
                       :value="item.value" :disabled="item.disabled"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>


    <!-- 查看专项检查对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="道路编码" prop="roadId">
          <el-input v-model="form.roadId"  />
        </el-form-item>
        <el-form-item label="道路名称" prop="roadName">
          <el-input v-model="form.roadName" />
        </el-form-item>
        <el-form-item label="隧道编码" prop="tunnelId">
          <el-input v-model="form.tunnelId"  />
        </el-form-item>
        <el-form-item label="隧道名称" prop="tunnelName">
          <el-input v-model="form.tunnelName"  />
        </el-form-item>
        <el-form-item label="里程桩号" prop="mileageNumber">
          <el-input v-model="form.mileageNumber"  />
        </el-form-item>
        <el-form-item label="设施名称" prop="facilityName">
          <el-input v-model="form.facilityName" />
        </el-form-item>
        <el-form-item label="检查内容">
          <editor v-model="form.examinationContent" :min-height="192"/>
        </el-form-item>
        <el-form-item label="上次日期" prop="lastInspectionDate">
          <el-date-picker clearable
                          v-model="form.lastInspectionDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="本次日期" prop="inspectionDate">
          <el-date-picker clearable
                          v-model="form.inspectionDate"
                          type="date"
                          value-format="yyyy-MM-dd"
                         >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="状况描述" prop="positionDescribe">
          <el-input v-model="form.positionDescribe"  />
        </el-form-item>
        <el-form-item label="建议" prop="advice">
          <el-input v-model="form.advice"  />
        </el-form-item>
        <el-form-item label="养护机构" prop="maintenanceOrganization">
          <el-input v-model="form.maintenanceOrganization"  />
        </el-form-item>
        <el-form-item label="检查人" prop="inspection">
          <el-input v-model="form.inspection"  />
        </el-form-item>
        <el-form-item label="检查状态" prop="inspectionCondition">
          <el-input v-model="form.inspectionCondition"  />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
<!--        <el-button type="primary" @click="submitForm">确 定</el-button>-->
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listSpecialinspection,
  getSpecialinspection,
  delSpecialinspection,
  addSpecialinspection,
  updateSpecialinspection,
  exportSpecialinspection
} from '@/api/biz/specialinspection'
import { exportAllmaintenance, getAllmaintenance } from '@/api/biz/allmaintenance'
import { listSuidao } from "@/api/biz/suidao";
import { listGonglu } from "@/api/biz/gonglu";
import { listFacility } from "@/api/civil/facility";
import log from '@/views/monitor/job/log'


export default {
  name: "Specialinspection",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 专项检查表格数据
      specialinspectionList: [],
      //隧道列表
      suidaoList: [],
      //道路列表
      gongluList: [],
      //设备列表
      facilityList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示增加或修改的弹出层
      openadd: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        roadId: null,
        roadName: null,
        tunnelId: null,
        tunnelName: null,
        mileageNumber: null,
        facilityName: null,
        examinationContent: null,
        lastInspectionDate: null,
        inspectionDate: null,
        positionDescribe: null,
        advice: null,
        maintenanceOrganization: null,
        inspection: null,
        inspectionCondition: null
      },
      // 表单参数
      form: {},
//技术状况描述
      fieldpositionDescribe: [{
        "label": "洞口状况值判断为0",
        "value": "完好，无破坏现象"
      }, {
        "label": "洞口状况值判断为1",
        "value": "山体及岩体、挡土墙、护坡等有轻微裂缝产生，排水设施存在轻微破坏"
      },{
        "label": "洞口状况值判断为2",
        "value": "山体及岩体裂缝发育，存在滑坡、崩塌的初步迹象，坡面树木或电线杆轻微倾斜，挡土墙、护坡等产生开裂、变形，土石零星掉落，排水设施存在一定裂损、阻塞"
      }, {
        "label": "洞口状况值判断为3",
        "value": "山体及岩体严重开裂，坡面树木或电线杆明显倾斜，挡土墙、护坡等产生严重开裂、明显的永久变形，墙角或坡面有土石堆积，排水设施完全堵塞、破坏，排水功能失效"
      },{
        "label": "洞口状况值判断为4",
        "value": "山体及岩体有明显而严重的滑动、崩塌现象，挡土墙、护坡断裂、外倾失稳、部分倒塌，坡面树木或电线杆倾倒等"
      },{
        "label": "洞门状况值判断为0",
        "value": "完好，无破坏现象"
      },{
        "label": "洞门状况值判断为1",
        "value": "墙身存在轻微的开裂、起层、剥落"
      },{
        "label": "洞口状况值判断为2",
        "value": "墙身结构局部开裂，墙身轻微倾斜、沉陷或错台，壁面轻微渗水，尚未妨害交通"
      },{
        "label": "洞口状况值判断为3",
        "value": "墙身结构严重开裂、错台﹔边墙出现起层、剥落，混凝土块可能掉落或已有掉落;钢筋外露、受到锈蚀，墙身有明显倾斜、沉陷或错台趋势，璧面严重渗水（挂冰)，将会妨害交通"
      },{
        "label": "洞口状况值判断为4",
        "value": "洞门结构大范围开裂、砌体断裂、混凝土块可能掉落或已有掉落;墙身出现部分倾倒、垮塌，存在喷水或大面积挂冰等，已妨碍交通"
      },{
        "label": "衬砌状况值判断为0",
        "value": "结构无裂损、变形和背后空洞"
      },{
        "label": "衬砌状况值判断为1",
        "value": "出现变形、位移、沉降和裂缝，但无发展或已停止发展"
      },{
        "label": "衬砌状况值判断为2",
        "value": "出现变形、位移、沉降和裂缝,发展缓慢，边墙衬砌背后存在空隙，有扩大的可能"
      },{
        "label": "衬砌状况值判断为3",
        "value": "出现变形、位移、沉降，裂缝密集，出现剪切性裂缝,发展速度较快;边墙处衬砌压裂，导致起层、剥落，边墙混凝土有可能掉下"
      },{
        "label": "衬砌状况值判断为4",
        "value": "衬砌结构发生明显的永久变形，裂缝密集，出现剪切性裂缝，裂缝深度贯穿衬砌混凝土，并且发展快速;"
      },{
        "label": "路面状况值判断为0",
        "value": "路面完好"
      },{
        "label": "路面状况值判断为1",
        "value": "路面有浸湿、轻微裂缝、落物等，引起使用者轻微不舒适感"
      },{
        "label": "路面状况值判断为2",
        "value": "路面有局部的沉陷、隆起、坑洞、表面剥落、露骨、破损、裂缝，轻微积水，引起使用者明显的不舒适感，可能会影响行车安全"
      },{
        "label": "路面状况值判断为3",
        "value": "路面出现较大面积的沉陷、隆起、坑洞、表面剥落、露骨、破损、裂缝、积水严重等，影响行车安全;抗滑系数过低引起车辆打滑"
      },{
        "label": "路面状况值判断为4",
        "value": "路面出现大面积的明显沉陷、隆起、坑洞，路面板严重错台、断裂、表面剥落、露骨、破损、裂缝,出现漫水、结冰或堆冰，严重影响交通安全"
      },{
        "label": "检修道状况值判断为0",
        "value": "护栏、路缘石及检修道面板均完好"
      },{
        "label": "检修道状况值判断为1",
        "value": "护栏变形，路缘石或检修道面板少量缺角、缺损，金属有局部锈蚀，尚未影响其使用功能"
      },{
        "label": "检修道状况值判断为2",
        "value": "护栏变形损坏，螺栓松动、扭曲，金属表面锈蚀，部分路缘石或检修道面板缺损、开裂，部分功能丧失，可能会影响行人和交通安全"
      },{
        "label": "检修道状况值判断为3",
        "value": "护栏倒伏、严重损坏,侵入限界，路缘石或检修道面板缺损开裂或缺失严重，原有功能丧失，影响行人和交通安全"
      },{
        "label": "排水设施状况值判断为0",
        "value": "设施完好，排水功能正常"
      },{
        "label": "排水设施状况值判断为1",
        "value": "结构有轻微破损，但排水功能正常"
      },{
        "label": "排水设施状况值判断为2",
        "value": "轻微淤积，结构有破损，暴雨季节出现溢水，可能会影响交通安全"
      },{
        "label": "排水设施状况值判断为3",
        "value": "严重淤积，结构较严重破损，溢水造成路面局部积水、结冰，影响行车安全"
      },{
        "label": "排水设施状况值判断为4",
        "value": "完全阻塞，结构严重破损，溢水造成路面积水漫流、大面积结冰，严重影响行车安全"
      },{
        "label": "吊顶及预埋件状况值判断为0",
        "value": "吊顶完好"
      },{
        "label": "吊顶及预埋件状况值判断为1",
        "value": "存在轻微变形、破损、浸水，尚未妨碍交通"
      },{
        "label": "吊顶及预埋件状况值判断为2",
        "value": "吊顶破损、开裂、滴水，吊杆等预埋件锈蚀，尚未影响交通安全"
      },{
        "label": "吊顶及预埋件状况值判断为3",
        "value": "吊顶存在较严重的变形、破损，出现涌流、挂冰，吊杆等预埋件严重锈蚀，可能影响交通安全"
      },{
        "label": "吊顶及预埋件状况值判断为4",
        "value": "吊顶严重破损、开裂甚至掉落，出现喷涌水、严重挂冰，各种预埋件和悬吊件严重锈蚀或断裂"
      },{
        "label": "内装饰物状况值判断为0",
        "value": "内装饰完好"
      },{
        "label": "内装饰物状况值判断为1",
        "value": "个别内装饰板或瓷砖变形、破损，不影响交通"
      },{
        "label": "内装饰物状况值判断为2",
        "value": "部分内装饰板或瓷砖变形、破损、脱落，对交通安全有影响"
      },{
        "label": "内装饰物状况值判断为3",
        "value": "大面积内装饰板或瓷砖变形、破损、脱落，严重影响行车安全"
      },{
        "label": "交通标志、标线状况值判断为0",
        "value": "完好"
      },{
        "label": "交通标志、标线状况值判断为1",
        "value": "存在油污、基本不妨碍交通"
      },{
        "label": "交通标志、标线状况值判断为2",
        "value": "存在脏污、不完整，尚未妨碍交通"
      },{
        "label": "交通标志、标线状况值判断为3",
        "value": "存在脏污、部分脱落、缺失，可能会影响交通安全"
      },{
        "label": "交通标志、标线状况值判断为4",
        "value": "大部分存在脏污、脱落、缺失，影响行车安全"
      },
      ],
      fieldfacility: [{
        "label": "洞口",
        "value": "洞口"
      }, {
        "label": "洞门",
        "value": "洞门"
      },{
        "label": "衬砌",
        "value": "衬砌"
      },{
        "label": "路面",
        "value": "路面"
      },{
        "label": "检修道",
        "value": "检修道"
      },{
        "label": "排水设施",
        "value": "排水设施"
      },{
        "label": "吊顶及预埋件",
        "value": "吊顶及预埋件"
      },{
        "label": "装饰物",
        "value": "装饰物"
      }, {
        "label": "交通标志/标线",
        "value": "交通标志/标线"
      }
      ],
      fieldinspectionCondition: [{
        "label": "未检查",
        "value": "未检查"
      }, {
        "label": "检查中",
        "value": "检查中"
      },{
        "label": "已检查",
        "value": "已检查"
      },
      ],
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    listSuidao({}).then((response) => {
      this.suidaoList = response.rows;
    });
    listGonglu({}).then((response) => {
      this.gongluList = response.rows;
    });
    listFacility({}).then((response) => {
      this.facilityList = response.rows;
    });
  },
  // 过滤相同的数据

  methods: {
    /** 查询专项检查列表 */
    getList() {
      this.loading = true;
      listSpecialinspection(this.queryParams).then(response => {
        this.specialinspectionList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.openadd = false;

      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        specialInspectionId: null,
        roadId: null,
        roadName: null,
        tunnelId: null,
        tunnelName: null,
        mileageNumber: null,
        facilityName: null,
        examinationContent: null,
        lastInspectionDate: null,
        inspectionDate: null,
        positionDescribe: null,
        advice: null,
        maintenanceOrganization: null,
        inspection: null,
        inspectionCondition: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.specialInspectionId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.openadd = true;
      this.title = "添加专项检查";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const specialInspectionId = row.specialInspectionId || this.ids
      getSpecialinspection(specialInspectionId).then(response => {
        this.form = response.data;
        this.openadd = true;
        this.title = "修改专项检查";
      });
    },
    //填写去检查评价按钮
    handleDesign7() {
      this.$router.push({path: '/specialevaluate/index'})
    },
    /** 查看按钮操作 */
    handleCheck(row) {
      this.reset();
      const specialInspectionId = row.specialInspectionId || this.ids
      getSpecialinspection(specialInspectionId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "查看养护方案计划";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.specialInspectionId != null) {
            updateSpecialinspection(this.form).then(response => {
              this.$modal.msgSuccess("专项检查和专项检查评价数据修改成功");
              this.openadd = false;
              this.getList();
            });
          } else {
            addSpecialinspection(this.form).then(response => {
              this.$modal.msgSuccess("专项检查和专项检查评价数据新增成功");
              this.openadd = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const specialInspectionIds = row.specialInspectionId || this.ids;
      this.$modal.confirm('是否确认删除专项检查和专项检查评价编号为"' + specialInspectionIds + '"的数据项？').then(function() {
        return delSpecialinspection(specialInspectionIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
  //   /** 导出按钮操作 */
  //   handleExport() {
  //     this.download('biz/specialinspection/export', {
  //       ...this.queryParams
  //     }, `specialinspection_${new Date().getTime()}.xlsx`)
  //   }
  // }
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$modal
        .confirm("是否确认导出所有数据项？")
        .then(() => {
          this.exportLoading = true;
          return exportSpecialinspection(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },
  },
};
</script>
